<template>
    <div class="list-content">
        <div class="list-header clearfix">
            <div class="list-header-tit fl">在线访谈</div>
            
            <div @click="backHome" class="list-close fr" style="font-size: 16px;background:#ffffff;">
            返回首页：
                <img src="../../assets/image/backhome.png" style="width:24px;height:24px;">
                <!--
                <i @click="backHome" class="list-close el-icon-circle-close"></i>
                -->
            </div>
            
        </div>
        <div class="list-table">
            <div class="home-table">
                <table class="app-table">
                    <thead>
                    <th>标题</th>
                    <th>访谈嘉宾</th>
                    <th>开始日期</th>
                    <th>发布单位</th>
                    </thead>
                    <tbody v-if="list.length">
                    <tr v-for="item in list" :key="item.id">
                        <td class="ellipsis" style="cursor:pointer;" @click="enterSuggestDet(item)">{{ item.title | filterWords }}</td>
                        <td>{{ item.guest }}</td>
                        <td>{{ item.liveStartTime }}</td>
                        <!--
                        <td>{{ item.collectType == "0" ? "进行中":"已结束" }}</td>
                        -->
                        <td>{{ item.deptId }}</td>
                        
                    </tr>
                    </tbody>
                    <tbody v-if="!list.length">
                    <tr>
                        <td>暂无数据</td>
                        <td>暂无数据</td>
                        <td>暂无数据</td>
                        <td>暂无数据</td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="page-wrap">
            <el-pagination
                    background
                    :current-page="pageIndex"
                    :page-size="pageSize"
                    @current-change="pageChange"
                    layout="prev, pager, next,jumper"
                    :total="Number(total)">
            </el-pagination>
        </div>
    </div>
</template>

<script>
    import {getMailList, getUserInfo} from '@/api'
 //   import router from "../../router";

    export default {
        data() {
            return {
                list: [],
                pageIndex: 1,
                pageSize: 10,
                total: 0,
            };
        },
        computed: {
            getUser() {
                return this.$store.state.user;
            }
        },
        mounted() {
            this.getData();
        },
        methods: {
            backHome() {
                this.$router.push({name: 'home'});
            },
            pageChange(num) {
                this.pageIndex = num;
                this.getList();
            },
            getData() { // 保证有userid
                if (this.getUser.id) {
                    this.getList();
                } else {
                    let url = '/sys/sysMember/getMember';
                    getUserInfo(url).then(res => {
                        if (res.data.code == 200) {
                            this.$store.commit('setUserinfo', {
                                id: res.data.data.id,
                                name: res.data.data.loginName,
                                mobile: res.data.data.mobile,
                            })
                            this.getList();
                        }
                    })
                }
            },
            getList() {
                let url = '/sys/sysMember/getfrontInterviewOverList';
                let params = {
                    memberId: this.getUser.id,
                    pageNum: this.pageIndex,
                    pageSize: this.pageSize,
                    depId:'46c1869861fd4555a284596f10a25f71'
                }
                getMailList(url, params).then(res => {
                    if (res.data.status == 'success') {
                        this.list = res.data.data.rows || [];
                        this.total = res.data.data.total || 0;
                    } else {
                        this.list = [];
                        this.total = 0;
                    }
                })
            },
            enterSuggestDet(item) {
                // let url = window.location.protocol+ '//'+window.location.host +'/account-center/a/sys/sysMember/toSolicitationDetail?urls=/h5/hd_myzj_input_pc.html&id='
                // let url = 'http://www.xinjiang.gov.cn/account-center/a/sys/sysMember/toSolicitationDetail?urls=/h5/hd_myzj_input_pc.html&id='
                // url = url + item.id;
                // url = url + '&memberId=' + this.getUser.id;
                // window.open(url, "_blank")

                let url = 'http://www.sc.gov.cn/10462/c100410/yjzj01.shtml?id=' + item.id;
                window.open(url, "_blank");
                /*
                if (item.collectType == "0") {
                    
                    if (process.env.NODE_ENV === "production") {
                        window.open("/usercenter/suggestionsDetail?id=" + item.id, "_blank")
                    } else {
                        window.open("/suggestionsDetail?id=" + item.id, "_blank")
                    }
                } else {
                    window.open(item.outjoin, "_blank")
                }*/

            },
        }
    };
</script>

<style lang="scss" scoped>

</style>
